import QtQuick 1.0

Rectangle {
    id: main
    width: 320
    height: 240
    opacity: 0.6

    MouseArea {
        anchors.fill: parent
        onClicked: {
            Qt.quit();
        }
    }

    /*
    MapViewer {
        id: mapviewer
        x: 0; y: 0; width: parent.width; height: parent.height
    }
        */

    BorisTable {
        id: boristable
        x: 0; y: 0; width: parent.width; height: parent.height
    }


    Compass {
        id: compass
        x: 0; y: 0; width: parent.height/3; height: parent.height/3
    }

    Satellites {
        id: satellites
        x: 0; y: parent.height/3; width: parent.height/3; height: parent.height/3
    }

    StatusBar {
        id: statusbar
        x: 0; y: 2*parent.height/3; width: parent.height/3; height: parent.height/3
    }

    states: [
        State {
            name: "compass"
            PropertyChanges { target: compass;      y:0; x: 0; width: parent.height; height: parent.height; }
            PropertyChanges { target: satellites;   y:parent.height/3; x: 0; width: 0; height:0; }
            PropertyChanges { target: statusbar;    y:2*parent.height/3; x: 0; width: 0; height: 0; }
        },
        State {
            name: "statusbar"
            PropertyChanges { target: satellites;   y:0; x: 0; width: parent.width; height: parent.height; }
            PropertyChanges { target: compass;      y:0; x: 0; width: 0; height:0; }
            PropertyChanges { target: statusbar;    y:2*parent.height/3; x: 0; width: 0; height: 0; }
        }    ]

    transitions: [
        Transition {
            from: "*"; to: "*"
            NumberAnimation {
                properties: "x,y,width,height"
                easing.type: Easing.InOutQuart
                duration: 800
            }
        }
    ]

    Connections { target: actions; onCompassClicked: main.state == "compass" ? main.state="" : main.state="compass"; }
    Connections { target: actions; onStatusClicked: main.state == "statusbar" ? main.state="" : main.state="statusbar"; }
    Connections { target: actions; onAboutClicked: console.log("menu not yet implemented") }
}
